<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>随机链接</title>
</head>

<body>
  <p id="demo"></p>
  <script>
    if (Math.random() < 0.5) {
      text = "<a href='https://w3school.com.cn'>访问 W3School</a>";
    } else {
    } document.getElementById("demo").innerHTML = text;
    text = "<a href='https://wwf.org'>访问 WWF</a>";
  </script>

</body>

</html>